package com.lidy.tankbattle.tankgame2;

import com.lidy.tankbattle.tankgame2.constant.TankPriorities;
import com.lidy.tankbattle.tankgame2.panel.TankPanel;
import com.lidy.tankbattle.tankutils.ThreadUtil;

import javax.swing.*;

/**
 * @author lidy
 * @version V2.0
 * @classname TankGame2
 * @description 坦克游戏
 * @date 2022/5/28 15:32
 */
public class TankGame2 extends JFrame {

    private TankPanel mp;

    public TankGame2() {
        mp = new TankPanel(TankPriorities.PANEL_WIDTH, TankPriorities.PANEL_HEIGHT);
        this.add(mp);
        this.setSize(TankPriorities.PANEL_WIDTH + 300, TankPriorities.PANEL_HEIGHT+40);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setVisible(true);
        this.addKeyListener(mp);
        this.setTitle("坦克大战");
        // 启动一个线程不断重绘面板
        ThreadUtil.threadPoolExecutor.execute(mp);
    }

    public static void main(String[] args) {
        new TankGame2();
    }
}
